package hardware;

public class UI {

	
public static final int ACC_AXIS_X		= 0;	
public static final int ACC_AXIS_Y		= 1;
public static final int ACC_AXIS_Z		= 2;


public static final byte KEY_LEFT_UP		= 0;
public static final byte KEY_LEFT_DOWN		= KEY_LEFT_UP+1;
public static final byte KEY_LEFT_LEFT		= KEY_LEFT_DOWN+1;
public static final byte KEY_LEFT_RIGHT		= KEY_LEFT_LEFT+1;

public static final byte KEY_RIGHT_UP		= KEY_LEFT_RIGHT+1;
public static final byte KEY_RIGHT_DOWN		= KEY_RIGHT_UP+1;
public static final byte KEY_RIGHT_LEFT		= KEY_RIGHT_DOWN+1;
public static final byte KEY_RIGHT_RIGHT	= KEY_RIGHT_LEFT+1;

public static boolean keyLUp=false;	
public static boolean keyLDown=false;
public static boolean keyLLeft=false;
public static boolean keyLRight=false;

public static boolean keyRUp=false;	
public static boolean keyRDown=false;
public static boolean keyRLeft=false;
public static boolean keyRRight=false;

public static boolean keyLUpFlank=false;	
public static boolean keyLDownFlank=false;
public static boolean keyLLeftFlank=false;
public static boolean keyLRightFlank=false;

public static boolean keyRUpFlank=false;	
public static boolean keyRDownFlank=false;
public static boolean keyRLeftFlank=false;
public static boolean keyRRightFlank=false;

public static byte accXValue=0;
public static byte accYValue=0;
public static byte accZValue=0;



public static boolean keyLUp()
{
	return(keyLUp);
}
public static boolean keyLDown()
{
	return(keyLDown);
}
public static boolean keyLLeft()
{
	return(keyLLeft);
}
public static boolean keyLRight()
{
	return(keyLRight);
}


public static boolean keyRUp()
{
	return(keyRUp);
}

public static boolean keyRDown()
{
	return(keyRDown);
}
public static boolean keyRRight()
{
	return(keyRRight);
}
public static boolean keyRLeft()
{
	return(keyRLeft);
}




public static byte getAccAxis(int axis)
{
	switch(axis)
	{
	case ACC_AXIS_X:
		return(accXValue);

	case ACC_AXIS_Y:
		return(accYValue);

	case ACC_AXIS_Z:
		return(accZValue);

		
	}

	
	
	
	return(0);
}


public static  boolean keyPressed(byte key)
{
	switch(key)
		{
		case KEY_LEFT_UP:
			if (keyLUpFlank==true)
				{
				keyLUpFlank=false;
				return(true);
				}
		break;
	
		
		case KEY_LEFT_DOWN:
			if (keyLDownFlank==true)
				{
				keyLDownFlank=false;
				return(true);
				}			
			break;

		case KEY_LEFT_LEFT:
			if (keyLLeftFlank==true)
				{
				keyLLeftFlank=false;
				return(true);
				}
			break;
			
		case KEY_LEFT_RIGHT:
			if (keyLRightFlank==true)
				{
				keyLRightFlank=false;
				return(true);
				}
			break;
			
		case KEY_RIGHT_UP:
			if (keyRUpFlank==true)
				{
				keyRUpFlank=false;
				return(true);
				}			
			break;
			
		case KEY_RIGHT_DOWN:
			if (keyRDownFlank==true)
				{
				keyRDownFlank=false;
				return(true);
				}			
		break;
			

			
		case KEY_RIGHT_LEFT:
			if (keyRLeftFlank==true)
				{
				keyRLeftFlank=false;
				return(true);
				}			
			
			break;
			
		case KEY_RIGHT_RIGHT:
			if (keyRRightFlank==true)
				{
				keyRRightFlank=false;
				return(true);
				}			

			break;
			

	
		}
// >TODO logic !!!!!

return(false);
}



}
